﻿#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>

int add(int a, int b)
{
	int ret = a + b;
	return ret;
}


int min(int a, int b)
{
	int ret = a - b;
	return ret;
}
int mul(int a, int b)
{
	int ret = a * b;
	return ret;
}
int div(int a, int b)
{
	int ret = a / b;
	return ret;
}

void calc(int (*P)(int, int))
{
	int a = 0;
	int b = 0;
	int ret = 0;

	printf("请输入两个操作数:");
	scanf("%d %d", &a, &b);
	ret = P(a, b);
	printf("%d", ret);

}
int input = 0;

int main()
{
	int a = 0;
	int b = 0;
	int input = 0;
	printf("请输入数字:");
	scanf("%d", &input);
	switch (input) 
	{
	case 1:
		calc(add);
		break;
	case 2:
		calc(min);
		break;
	case 3:
		calc(mul);
		break;
	case 4:
		calc(div);
		break;
	case 0:
		break;
	}

	 
	return 0;
}



